package mani.threads;

import java.util.concurrent.ThreadFactory;

public class MyThreadFactory implements ThreadFactory{
	private String name;
	private int counter; 

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getCounter() {
		return counter;
	}

	public void setCounter(int counter) {
		this.counter = counter;
	}
	
	MyThreadFactory(String name){
		counter=0;
		this.name=name;
	}

	@Override
	public Thread newThread(Runnable r) {
		// TODO Auto-generated method stub
		Thread t = new Thread(r, name+"-Thread "+counter);
		counter++;
		System.out.println("....."+t.getName()+" "+counter);
		return t;
	}

}
